package com.dx.VegetableOxygenBarBackEnd.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dx.VegetableOxygenBarBackEnd.mapper.MessagesMapper;
import com.dx.VegetableOxygenBarBackEnd.model.domain.entity.Messages;
import com.dx.VegetableOxygenBarBackEnd.service.MessagesService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author dengxiao
* @description 针对表【messages】的数据库操作Service实现
* @createDate 2024-09-09 11:39:55
*/
@Service
public class MessagesServiceImpl extends ServiceImpl<MessagesMapper, Messages>
        implements MessagesService {
    @Override
    // MessagesService.java
    public List<Messages> getUnreadMessagesForReceiver(int reveiverId ,int sendId) {
        return this.lambdaQuery()
                .eq(Messages::getSenderId, sendId)
                .eq(Messages::getReceiverId, reveiverId)
//                .eq(Messages::getIsRead, 0)  // 仅查询未读消息
                .list();
    }


    // 可以在这里实现自定义的业务逻辑
}




